#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n;
    char str[305];
    FILE *fp;
    fp = fopen("test01.txt", "w+");
    while(~scanf("%d", &n) && n)
    {
        getchar();
        int i;
        for(i=1; i<=n; i++)
        {
            gets(str);
            //fp = fopen("test01.txt", "a+");
            fprintf(fp, "%s\n", str);
        }
    }
    fclose(fp);
    fp = fopen("test01.txt", "r");
    if((fp=fopen("test01.txt", "r")) == NULL)
    {
        printf("Fail to open!\n");
        exit(0);
    }
    while((fgets(str, 305, fp) != NULL))
        printf("%s", str);
    fclose(fp);
    return 0;
}
